/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-04-04 11:56:03
 * @LastEditors: voanit
 * @LastEditTime: 2022-04-04 16:59:44
 */
// 导入axios实例
import request from "@/utils/request";

// 根据业务要求- 查接口文档-封装api
/**
 * 获取所有角色信息
 * @param {*} params  {page, pagesize}
 * @returns
 */
export function getRoles(params) {
  return request({
    url: "/sys/role",
    method: "GET",
    params: params,
  });
}

/**
 * @description: 删除角色
 * @param {*} id 角色id
 * @return {*}
 */
export function deleteRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: "delete",
  });
}

/**
 * @description: 新增角色
 * @param {*} data {name,description}
 * @return {*}
 */
export function addRole(data) {
  return request({
    url: "/sys/role",
    method: "post",
    data,
  });
}

/**
 * @description: 编辑角色
 * @param {*} data
 * @return {*}
 */
export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: "put",
    data,
  });
}
